<template>
	<view class="center fontS28 color_222222">
		<u-parse selectable :content="privacy">
		</u-parse>
	</view>
</template>

<script setup>
	import {
		ref,
		getCurrentInstance
	} from 'vue';

	import {
		onLoad,
	} from '@dcloudio/uni-app';

	const {
		proxy
	} = getCurrentInstance();

	const type = ref('');
	const privacy = ref('');

	const acquisitionProtocol = () => {
		if (type.value == "privacy") {
			proxy.$api.userPrivacy().then(res => {
				privacy.value = res.data.replaceAll("\n", "<br>");

				console.log(privacy.value)
			})
		} else {
			proxy.$api.userProtocol().then(res => {
				privacy.value = res.data.replaceAll("\n", "<br>");
			})
		}
	}

	onLoad((e) => {
		type.value = e.title;
		uni.setNavigationBarTitle({
			title: e.title == "privacy" ? '隐私协议' : '用户协议'
		})

		acquisitionProtocol();
	})
</script>

<style lang="scss" scoped>
	.center {
		padding: 30rpx 15rpx 30rpx 20rpx;
		line-height: 1.7;
	}
</style>